<?
	$fieldId = $this->formGetElementId($form_model_class.'_'.$form_field->dbName.uniqid());
?>

<div class="code_wrapper">
	<textarea class="<?= $form_field->size ?>" id="<?= $fieldId ?>" name="<?= $form_model_class ?>[<?= $form_field->dbName ?>]"><?= h($form_model->displayField($form_field->dbName)) ?></textarea>
</div>

<script type="text/javascript">
	var thisTab = $('<?= $fieldId ?>').getTab();
	if (thisTab)
	{
		thisTab.addEvent('onTabClick', function(){
			if (!phpr_field_initialized.has('<?= $fieldId ?>') && $('<?= $fieldId ?>').isVisible())
			{
				init_codemirror('<?= $fieldId ?>', '<?= $form_field->language ?>', '<?= $form_field->saveCallback ?>');
				phpr_field_initialized.set('<?= $fieldId ?>', 1);
			}
		})
	} else
	{
		window.addEvent('domready', function(){
			init_codemirror('<?= $fieldId ?>', '<?= $form_field->language ?>', '<?= $form_field->saveCallback ?>');
		});
	}
</script>
</head>